//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#if _MSC_VER > 1000
#pragma once
#endif

#ifndef __mscom_h__
#define __mscom_h__

typedef union _LARGE_INTEGER
{
    struct
    {
        UInt32 LowPart;
        Int32 HighPart;
    } u;
    Int64 QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;

typedef union _ULARGE_INTEGER
{
    struct
    {
        UInt32 LowPart;
        UInt32 HighPart;
    } u;
    UInt64 QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;

typedef struct  _tagFILETIME
{
    UInt32 dwLowDateTime;
    UInt32 dwHighDateTime;
} FILETIME;

#ifdef __cplusplus
extern "C"{
#endif

/* Forward Declarations */

#ifndef __IUnknown_FWD_DEFINED__
#define __IUnknown_FWD_DEFINED__
typedef interface IUnknown IUnknown;
#endif     /* __IUnknown_FWD_DEFINED__ */

#ifndef __IClassFactory_FWD_DEFINED__
#define __IClassFactory_FWD_DEFINED__
typedef interface IClassFactory IClassFactory;
#endif     /* __IClassFactory_FWD_DEFINED__ */

#ifndef __IMalloc_FWD_DEFINED__
#define __IMalloc_FWD_DEFINED__
typedef interface IMalloc IMalloc;
#endif     /* __IMalloc_FWD_DEFINED__ */

#ifndef __IMallocSpy_FWD_DEFINED__
#define __IMallocSpy_FWD_DEFINED__
typedef interface IMallocSpy IMallocSpy;
#endif     /* __IMallocSpy_FWD_DEFINED__ */

#ifndef __ISequentialStream_FWD_DEFINED__
#define __ISequentialStream_FWD_DEFINED__
typedef interface ISequentialStream ISequentialStream;
#endif     /* __ISequentialStream_FWD_DEFINED__ */

#ifndef __IStream_FWD_DEFINED__
#define __IStream_FWD_DEFINED__
typedef interface IStream IStream;
#endif     /* __IStream_FWD_DEFINED__ */

/* header files for imported files */
#include "elatypes.h"

#ifndef __IUnknown_INTERFACE_DEFINED__
#define __IUnknown_INTERFACE_DEFINED__

/* interface IUnknown */
/* [uuid][local][object] */

typedef /* [unique] */ IUnknown *PUNKNOWN;

EXTERN_C const IID IID_IUnknown;

#if defined(__cplusplus) && !defined(CINTERFACE)

MIDL_INTERFACE("00000000-0000-0000-C000-000000000046") IUnknown
{
public:
    virtual CARAPI QueryInterface(
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppv) = 0;

    virtual UInt32 STDMETHODCALLTYPE AddRef( void) = 0;

    virtual UInt32 STDMETHODCALLTYPE Release( void) = 0;
};

#else

typedef struct IUnknownVtbl
    {

        ECode (CARAPICALLTYPE *QueryInterface )(
            IUnknown * This,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppv);

        UInt32 (CARAPICALLTYPE *AddRef )(
            IUnknown * This);

        UInt32 (CARAPICALLTYPE *Release )(
            IUnknown * This);

    } IUnknownVtbl;

interface IUnknown
    {
        CONST_VTBL struct IUnknownVtbl *v;
    };

#ifdef COBJMACROS

#define IUnknown_QueryInterface(This,riid,ppv)    \
    (This)->v -> QueryInterface(This,riid,ppv)

#define IUnknown_AddRef(This)    \
    (This)->v -> AddRef(This)

#define IUnknown_Release(This)    \
    (This)->v -> Release(This)

#endif /* COBJMACROS */

#endif     /* C style interface */

#endif     /* __IUnknown_INTERFACE_DEFINED__ */

#ifndef __IClassFactory_INTERFACE_DEFINED__
#define __IClassFactory_INTERFACE_DEFINED__

/* interface IClassFactory */
/* [uuid][local][object] */

typedef /* [unique] */ IClassFactory *PCLASSFACTORY;

EXTERN_C const IID IID_IClassFactory;

#if defined(__cplusplus) && !defined(CINTERFACE)

MIDL_INTERFACE("00000001-0000-0000-C000-000000000046") IClassFactory : public IUnknown
{
public:
    virtual CARAPI CreateObject(
            /* [in] */ IUnknown *pUnkOuter,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppvObject) = 0;

    virtual CARAPI LockServer(
            /* [in] */ _ELASTOS Boolean fLock) = 0;
};

#else

typedef struct IClassFactoryVtbl
    {

        ECode (CARAPICALLTYPE *QueryInterface )(
            IClassFactory * This,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppv);

        UInt32 (CARAPICALLTYPE *AddRef )(
            IClassFactory * This);

        UInt32 (CARAPICALLTYPE *Release )(
            IClassFactory * This);

        ECode (CARAPICALLTYPE *CreateObject )(
            IClassFactory * This,
            /* [in] */ IUnknown *pUnkOuter,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppvObject);

        ECode (CARAPICALLTYPE *LockServer )(
            IClassFactory * This,
            /* [in] */ _ELASTOS Boolean fLock);

    } IClassFactoryVtbl;

interface IClassFactory
    {
        CONST_VTBL struct IClassFactoryVtbl *v;
    };

#ifdef COBJMACROS

#define IClassFactory_QueryInterface(This,riid,ppv)    \
    (This)->v -> QueryInterface(This,riid,ppv)

#define IClassFactory_AddRef(This)    \
    (This)->v -> AddRef(This)

#define IClassFactory_Release(This)    \
    (This)->v -> Release(This)

#define IClassFactory_CreateObject(This,pUnkOuter,riid,ppvObject)    \
    (This)->v -> CreateObject(This,pUnkOuter,riid,ppvObject)

#define IClassFactory_LockServer(This,fLock)    \
    (This)->v -> LockServer(This,fLock)

#endif /* COBJMACROS */

#endif     /* C style interface */

#endif     /* __IClassFactory_INTERFACE_DEFINED__ */

#ifndef __IMalloc_INTERFACE_DEFINED__
#define __IMalloc_INTERFACE_DEFINED__

/* interface IMalloc */
/* [uuid][local][object] */

typedef /* [unique] */ IMalloc *PMALLOC;

EXTERN_C const IID IID_IMalloc;

#if defined(__cplusplus) && !defined(CINTERFACE)

MIDL_INTERFACE("00000002-0000-0000-C000-000000000046") IMalloc : public IUnknown
{
public:
    virtual PVoid STDMETHODCALLTYPE Alloc(
            /* [in] */ size_t cb) = 0;

    virtual PVoid STDMETHODCALLTYPE Realloc(
            /* [in] */ PVoid pv,
            /* [in] */ size_t cb) = 0;

    virtual void STDMETHODCALLTYPE Free(
            /* [in] */ PVoid pv) = 0;

    virtual size_t STDMETHODCALLTYPE GetSize(
            /* [in] */ PVoid pv) = 0;

    virtual Int32 STDMETHODCALLTYPE DidAlloc(
            /* [in] */ PVoid pv) = 0;

    virtual void STDMETHODCALLTYPE HeapMinimize( void) = 0;
};

#else

typedef struct IMallocVtbl
    {

        ECode (CARAPICALLTYPE *QueryInterface )(
            IMalloc * This,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppv);

        UInt32 (CARAPICALLTYPE *AddRef )(
            IMalloc * This);

        UInt32 (CARAPICALLTYPE *Release )(
            IMalloc * This);

        PVoid ( STDMETHODCALLTYPE *Alloc )(
            IMalloc * This,
            /* [in] */ size_t cb);

        PVoid ( STDMETHODCALLTYPE *Realloc )(
            IMalloc * This,
            /* [in] */ PVoid pv,
            /* [in] */ size_t cb);

        void ( STDMETHODCALLTYPE *Free )(
            IMalloc * This,
            /* [in] */ PVoid pv);

        size_t ( STDMETHODCALLTYPE *GetSize )(
            IMalloc * This,
            /* [in] */ PVoid pv);

        Int32 ( STDMETHODCALLTYPE *DidAlloc )(
            IMalloc * This,
            /* [in] */ PVoid pv);

        void ( STDMETHODCALLTYPE *HeapMinimize )(
            IMalloc * This);

    } IMallocVtbl;

interface IMalloc
    {
        CONST_VTBL struct IMallocVtbl *v;
    };

#ifdef COBJMACROS

#define IMalloc_QueryInterface(This,riid,ppv)    \
    (This)->v -> QueryInterface(This,riid,ppv)

#define IMalloc_AddRef(This)    \
    (This)->v -> AddRef(This)

#define IMalloc_Release(This)    \
    (This)->v -> Release(This)

#define IMalloc_Alloc(This,cb)    \
    (This)->v -> Alloc(This,cb)

#define IMalloc_Realloc(This,pv,cb)    \
    (This)->v -> Realloc(This,pv,cb)

#define IMalloc_Free(This,pv)    \
    (This)->v -> Free(This,pv)

#define IMalloc_GetSize(This,pv)    \
    (This)->v -> GetSize(This,pv)

#define IMalloc_DidAlloc(This,pv)    \
    (This)->v -> DidAlloc(This,pv)

#define IMalloc_HeapMinimize(This)    \
    (This)->v -> HeapMinimize(This)

#endif /* COBJMACROS */

#endif     /* C style interface */

#endif     /* __IMalloc_INTERFACE_DEFINED__ */

#ifndef __IMallocSpy_INTERFACE_DEFINED__
#define __IMallocSpy_INTERFACE_DEFINED__

/* interface IMallocSpy */
/* [uuid][local][object] */

typedef /* [unique] */ IMallocSpy *PMALLOCSPY;

EXTERN_C const IID IID_IMallocSpy;

#if defined(__cplusplus) && !defined(CINTERFACE)

MIDL_INTERFACE("0000001d-0000-0000-C000-000000000046") IMallocSpy : public IUnknown
{
public:
    virtual size_t STDMETHODCALLTYPE PreAlloc(
            /* [in] */ size_t cbRequest) = 0;

    virtual PVoid STDMETHODCALLTYPE PostAlloc(
            /* [in] */ PVoid pActual) = 0;

    virtual PVoid STDMETHODCALLTYPE PreFree(
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed) = 0;

    virtual void STDMETHODCALLTYPE PostFree(
            /* [in] */ _ELASTOS Boolean fSpyed) = 0;

    virtual size_t STDMETHODCALLTYPE PreRealloc(
            /* [in] */ PVoid pRequest,
            /* [in] */ size_t cbRequest,
            /* [out] */ void **ppNewRequest,
            /* [in] */ _ELASTOS Boolean fSpyed) = 0;

    virtual PVoid STDMETHODCALLTYPE PostRealloc(
            /* [in] */ PVoid pActual,
            /* [in] */ _ELASTOS Boolean fSpyed) = 0;

    virtual PVoid STDMETHODCALLTYPE PreGetSize(
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed) = 0;

    virtual size_t STDMETHODCALLTYPE PostGetSize(
            /* [in] */ size_t cbActual,
            /* [in] */ _ELASTOS Boolean fSpyed) = 0;

    virtual PVoid STDMETHODCALLTYPE PreDidAlloc(
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed) = 0;

    virtual Int32 STDMETHODCALLTYPE PostDidAlloc(
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed,
            /* [in] */ int fActual) = 0;

    virtual void STDMETHODCALLTYPE PreHeapMinimize( void) = 0;

    virtual void STDMETHODCALLTYPE PostHeapMinimize( void) = 0;
};

#else

typedef struct IMallocSpyVtbl
    {

        ECode (CARAPICALLTYPE *QueryInterface )(
            IMallocSpy * This,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppv);

        UInt32 (CARAPICALLTYPE *AddRef )(
            IMallocSpy * This);

        UInt32 (CARAPICALLTYPE *Release )(
            IMallocSpy * This);

        size_t ( STDMETHODCALLTYPE *PreAlloc )(
            IMallocSpy * This,
            /* [in] */ size_t cbRequest);

        PVoid ( STDMETHODCALLTYPE *PostAlloc )(
            IMallocSpy * This,
            /* [in] */ PVoid pActual);

        PVoid ( STDMETHODCALLTYPE *PreFree )(
            IMallocSpy * This,
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed);

        void ( STDMETHODCALLTYPE *PostFree )(
            IMallocSpy * This,
            /* [in] */ _ELASTOS Boolean fSpyed);

        size_t ( STDMETHODCALLTYPE *PreRealloc )(
            IMallocSpy * This,
            /* [in] */ PVoid pRequest,
            /* [in] */ size_t cbRequest,
            /* [out] */ void **ppNewRequest,
            /* [in] */ _ELASTOS Boolean fSpyed);

        PVoid ( STDMETHODCALLTYPE *PostRealloc )(
            IMallocSpy * This,
            /* [in] */ PVoid pActual,
            /* [in] */ _ELASTOS Boolean fSpyed);

        PVoid ( STDMETHODCALLTYPE *PreGetSize )(
            IMallocSpy * This,
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed);

        size_t ( STDMETHODCALLTYPE *PostGetSize )(
            IMallocSpy * This,
            /* [in] */ size_t cbActual,
            /* [in] */ _ELASTOS Boolean fSpyed);

        PVoid ( STDMETHODCALLTYPE *PreDidAlloc )(
            IMallocSpy * This,
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed);

        Int32 ( STDMETHODCALLTYPE *PostDidAlloc )(
            IMallocSpy * This,
            /* [in] */ PVoid pRequest,
            /* [in] */ _ELASTOS Boolean fSpyed,
            /* [in] */ int fActual);

        void ( STDMETHODCALLTYPE *PreHeapMinimize )(
            IMallocSpy * This);

        void ( STDMETHODCALLTYPE *PostHeapMinimize )(
            IMallocSpy * This);

    } IMallocSpyVtbl;

interface IMallocSpy
    {
        CONST_VTBL struct IMallocSpyVtbl *v;
    };

#ifdef COBJMACROS

#define IMallocSpy_QueryInterface(This,riid,ppv)    \
    (This)->v -> QueryInterface(This,riid,ppv)

#define IMallocSpy_AddRef(This)    \
    (This)->v -> AddRef(This)

#define IMallocSpy_Release(This)    \
    (This)->v -> Release(This)

#define IMallocSpy_PreAlloc(This,cbRequest)    \
    (This)->v -> PreAlloc(This,cbRequest)

#define IMallocSpy_PostAlloc(This,pActual)    \
    (This)->v -> PostAlloc(This,pActual)

#define IMallocSpy_PreFree(This,pRequest,fSpyed)    \
    (This)->v -> PreFree(This,pRequest,fSpyed)

#define IMallocSpy_PostFree(This,fSpyed)    \
    (This)->v -> PostFree(This,fSpyed)

#define IMallocSpy_PreRealloc(This,pRequest,cbRequest,ppNewRequest,fSpyed)    \
    (This)->v -> PreRealloc(This,pRequest,cbRequest,ppNewRequest,fSpyed)

#define IMallocSpy_PostRealloc(This,pActual,fSpyed)    \
    (This)->v -> PostRealloc(This,pActual,fSpyed)

#define IMallocSpy_PreGetSize(This,pRequest,fSpyed)    \
    (This)->v -> PreGetSize(This,pRequest,fSpyed)

#define IMallocSpy_PostGetSize(This,cbActual,fSpyed)    \
    (This)->v -> PostGetSize(This,cbActual,fSpyed)

#define IMallocSpy_PreDidAlloc(This,pRequest,fSpyed)    \
    (This)->v -> PreDidAlloc(This,pRequest,fSpyed)

#define IMallocSpy_PostDidAlloc(This,pRequest,fSpyed,fActual)    \
    (This)->v -> PostDidAlloc(This,pRequest,fSpyed,fActual)

#define IMallocSpy_PreHeapMinimize(This)    \
    (This)->v -> PreHeapMinimize(This)

#define IMallocSpy_PostHeapMinimize(This)    \
    (This)->v -> PostHeapMinimize(This)

#endif /* COBJMACROS */

#endif     /* C style interface */

#endif     /* __IMallocSpy_INTERFACE_DEFINED__ */

#ifndef __ISequentialStream_INTERFACE_DEFINED__
#define __ISequentialStream_INTERFACE_DEFINED__

/* interface ISequentialStream */
/* [uuid][object] */

typedef /* [unique] */ ISequentialStream *PSEQUENTIALSTREAM;

EXTERN_C const IID IID_ISequentialStream;

#if defined(__cplusplus) && !defined(CINTERFACE)

MIDL_INTERFACE("0c733a30-2a1c-11ce-ade5-00aa0044773d") ISequentialStream : public IUnknown
{
public:
    virtual CARAPI Read(
            /* [size_is][out] */ byte *pv,
            /* [in] */ UInt32 cb,
            /* [out] */ UInt32 *pcbRead) = 0;

    virtual CARAPI Write(
            /* [size_is][in] */ const byte *pv,
            /* [in] */ UInt32 cb,
            /* [out] */ UInt32 *pcbWritten) = 0;
};

#else

typedef struct ISequentialStreamVtbl
    {

        ECode (CARAPICALLTYPE *QueryInterface )(
            ISequentialStream * This,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppv);

        UInt32 (CARAPICALLTYPE *AddRef )(
            ISequentialStream * This);

        UInt32 (CARAPICALLTYPE *Release )(
            ISequentialStream * This);

        ECode (CARAPICALLTYPE *Read )(
            ISequentialStream * This,
            /* [size_is][out] */ byte *pv,
            /* [in] */ UInt32 cb,
            /* [out] */ UInt32 *pcbRead);

        ECode (CARAPICALLTYPE *Write )(
            ISequentialStream * This,
            /* [size_is][in] */ const byte *pv,
            /* [in] */ UInt32 cb,
            /* [out] */ UInt32 *pcbWritten);

    } ISequentialStreamVtbl;

interface ISequentialStream
    {
        CONST_VTBL struct ISequentialStreamVtbl *v;
    };

#ifdef COBJMACROS

#define ISequentialStream_QueryInterface(This,riid,ppv)    \
    (This)->v -> QueryInterface(This,riid,ppv)

#define ISequentialStream_AddRef(This)    \
    (This)->v -> AddRef(This)

#define ISequentialStream_Release(This)    \
    (This)->v -> Release(This)

#define ISequentialStream_Read(This,pv,cb,pcbRead)    \
    (This)->v -> Read(This,pv,cb,pcbRead)

#define ISequentialStream_Write(This,pv,cb,pcbWritten)    \
    (This)->v -> Write(This,pv,cb,pcbWritten)

#endif /* COBJMACROS */

#endif     /* C style interface */

#endif     /* __ISequentialStream_INTERFACE_DEFINED__ */

#ifndef __IStream_INTERFACE_DEFINED__
#define __IStream_INTERFACE_DEFINED__

/* interface IStream */
/* [uuid][object] */

typedef /* [unique] */ IStream *PSTREAM;

typedef struct  tagSTATSTG
    {
    wchar_t * pwcsName;
    UInt32 type;
    ULARGE_INTEGER cbSize;
    FILETIME mtime;
    FILETIME ctime;
    FILETIME atime;
    UInt32 grfMode;
    UInt32 grfLocksSupported;
    CLSID clsid;
    UInt32 grfStateBits;
    UInt32 reserved;
    }    STATSTG;

typedef
enum tagSTGTY
    {
		STGTY_STORAGE = 1,
    	STGTY_STREAM = 2,
    	STGTY_LOCKBYTES = 3,
    	STGTY_PROPERTY = 4
    }   STGTY;

typedef
enum tagSTREAM_SEEK
    {
		STREAM_SEEK_SET = 0,
    	STREAM_SEEK_CUR = 1,
    	STREAM_SEEK_END = 2
    }   STREAM_SEEK;

typedef
enum tagLOCKTYPE
    {
		LOCK_WRITE = 1,
    	LOCK_EXCLUSIVE = 2,
    	LOCK_ONLYONCE = 4
    }   LOCKTYPE;

EXTERN_C const IID IID_IStream;

#if defined(__cplusplus) && !defined(CINTERFACE)

MIDL_INTERFACE("0000000c-0000-0000-C000-000000000046") IStream : public ISequentialStream
{
public:
    virtual CARAPI Seek(
            /* [in] */ LARGE_INTEGER dlibMove,
            /* [in] */ UInt32 dwOrigin,
            /* [out] */ ULARGE_INTEGER *plibNewPosition) = 0;

    virtual CARAPI SetSize(
            /* [in] */ ULARGE_INTEGER libNewSize) = 0;

    virtual CARAPI CopyTo(
            /* [unique][in] */ IStream *pstm,
            /* [in] */ ULARGE_INTEGER cb,
            /* [out] */ ULARGE_INTEGER *pcbRead,
            /* [out] */ ULARGE_INTEGER *pcbWritten) = 0;

    virtual CARAPI Commit(
            /* [in] */ UInt32 grfCommitFlags) = 0;

    virtual CARAPI Revert( void) = 0;

    virtual CARAPI LockRegion(
            /* [in] */ ULARGE_INTEGER libOffset,
            /* [in] */ ULARGE_INTEGER cb,
            /* [in] */ UInt32 dwLockType) = 0;

    virtual CARAPI UnlockRegion(
            /* [in] */ ULARGE_INTEGER libOffset,
            /* [in] */ ULARGE_INTEGER cb,
            /* [in] */ UInt32 dwLockType) = 0;

    virtual CARAPI Stat(
            /* [out] */ STATSTG *pstatstg,
            /* [in] */ UInt32 grfStatFlag) = 0;

    virtual CARAPI Clone(
            /* [out] */ IStream **ppstm) = 0;

    virtual CARAPI Flush( void) = 0;
};

#else

typedef struct IStreamVtbl
    {

        ECode (CARAPICALLTYPE *QueryInterface )(
            IStream * This,
            /* [in] */ RIID riid,
            /* [iid_is][out] */ void **ppv);

        UInt32 (CARAPICALLTYPE *AddRef )(
            IStream * This);

        UInt32 (CARAPICALLTYPE *Release )(
            IStream * This);

        ECode (CARAPICALLTYPE *Read )(
            IStream * This,
            /* [size_is][out] */ byte *pv,
            /* [in] */ UInt32 cb,
            /* [out] */ UInt32 *pcbRead);

        ECode (CARAPICALLTYPE *Write )(
            IStream * This,
            /* [size_is][in] */ const byte *pv,
            /* [in] */ UInt32 cb,
            /* [out] */ UInt32 *pcbWritten);

        ECode (CARAPICALLTYPE *Seek )(
            IStream * This,
            /* [in] */ LARGE_INTEGER dlibMove,
            /* [in] */ UInt32 dwOrigin,
            /* [out] */ ULARGE_INTEGER *plibNewPosition);

        ECode (CARAPICALLTYPE *SetSize )(
            IStream * This,
            /* [in] */ ULARGE_INTEGER libNewSize);

        ECode (CARAPICALLTYPE *CopyTo )(
            IStream * This,
            /* [unique][in] */ IStream *pstm,
            /* [in] */ ULARGE_INTEGER cb,
            /* [out] */ ULARGE_INTEGER *pcbRead,
            /* [out] */ ULARGE_INTEGER *pcbWritten);

        ECode (CARAPICALLTYPE *Commit )(
            IStream * This,
            /* [in] */ UInt32 grfCommitFlags);

        ECode (CARAPICALLTYPE *Revert )(
            IStream * This);

        ECode (CARAPICALLTYPE *LockRegion )(
            IStream * This,
            /* [in] */ ULARGE_INTEGER libOffset,
            /* [in] */ ULARGE_INTEGER cb,
            /* [in] */ UInt32 dwLockType);

        ECode (CARAPICALLTYPE *UnlockRegion )(
            IStream * This,
            /* [in] */ ULARGE_INTEGER libOffset,
            /* [in] */ ULARGE_INTEGER cb,
            /* [in] */ UInt32 dwLockType);

        ECode (CARAPICALLTYPE *Stat )(
            IStream * This,
            /* [out] */ STATSTG *pstatstg,
            /* [in] */ UInt32 grfStatFlag);

        ECode (CARAPICALLTYPE *Clone )(
            IStream * This,
            /* [out] */ IStream **ppstm);

        ECode (CARAPICALLTYPE *Flush )(
            IStream * This);

    } IStreamVtbl;

interface IStream
    {
        CONST_VTBL struct IStreamVtbl *v;
    };

#ifdef COBJMACROS

#define IStream_QueryInterface(This,riid,ppv)    \
    (This)->v -> QueryInterface(This,riid,ppv)

#define IStream_AddRef(This)    \
    (This)->v -> AddRef(This)

#define IStream_Release(This)    \
    (This)->v -> Release(This)

#define IStream_Read(This,pv,cb,pcbRead)    \
    (This)->v -> Read(This,pv,cb,pcbRead)

#define IStream_Write(This,pv,cb,pcbWritten)    \
    (This)->v -> Write(This,pv,cb,pcbWritten)

#define IStream_Seek(This,dlibMove,dwOrigin,plibNewPosition)    \
    (This)->v -> Seek(This,dlibMove,dwOrigin,plibNewPosition)

#define IStream_SetSize(This,libNewSize)    \
    (This)->v -> SetSize(This,libNewSize)

#define IStream_CopyTo(This,pstm,cb,pcbRead,pcbWritten)    \
    (This)->v -> CopyTo(This,pstm,cb,pcbRead,pcbWritten)

#define IStream_Commit(This,grfCommitFlags)    \
    (This)->v -> Commit(This,grfCommitFlags)

#define IStream_Revert(This)    \
    (This)->v -> Revert(This)

#define IStream_LockRegion(This,libOffset,cb,dwLockType)    \
    (This)->v -> LockRegion(This,libOffset,cb,dwLockType)

#define IStream_UnlockRegion(This,libOffset,cb,dwLockType)    \
    (This)->v -> UnlockRegion(This,libOffset,cb,dwLockType)

#define IStream_Stat(This,pstatstg,grfStatFlag)    \
    (This)->v -> Stat(This,pstatstg,grfStatFlag)

#define IStream_Clone(This,ppstm)    \
    (This)->v -> Clone(This,ppstm)

#define IStream_Flush(This)    \
    (This)->v -> Flush(This)

#endif /* COBJMACROS */

#endif     /* C style interface */

#endif     /* __IStream_INTERFACE_DEFINED__ */

/* interface __MIDL_itf_mscom_0007 */
/* [local] */

typedef struct  _COAUTHIDENTITY
    {
    /* [size_is] */ UInt16 *User;
    UInt32 UserLength;
    /* [size_is] */ UInt16 *Domain;
    UInt32 DomainLength;
    /* [size_is] */ UInt16 *Password;
    UInt32 PasswordLength;
    UInt32 Flags;
    }    COAUTHIDENTITY;

typedef struct  _COAUTHINFO
    {
    UInt32 dwAuthnSvc;
    UInt32 dwAuthzSvc;
    wchar_t * pwszServerPrincName;
    UInt32 dwAuthnLevel;
    UInt32 dwImpersonationLevel;
    COAUTHIDENTITY *pAuthIdentityData;
    UInt32 dwCapabilities;
    }    COAUTHINFO;

typedef struct  _COSERVERINFO
    {
    UInt32 dwReserved1;
    wchar_t * pwszName;
    COAUTHINFO *pAuthInfo;
    UInt32 dwReserved2;
    }    COSERVERINFO;

/* Additional Prototypes for ALL interfaces */

/* end of Additional Prototypes */

#ifdef __cplusplus
}
#endif

#endif
